#include "State.h"


State::State(void)
{
	// Constant Values
	mass = 1;
	invMass = 1;
	inertia = 1;
	invInertia = 1;

	// Primary Values
	position = vector3();
	momentum = vector3();
	orientation = quaternion();
	angularMomentum = vector3();

	// Secondary Values
	velocity = vector3();
	spin = quaternion();
	angularVelocity = vector3();

	// Force accumulators
	force = vector3();
	torque = vector3();

	// Friction simulation
	fDamp = -0.1;
	tDamp = -10.0;
}

State::State(vector3 ix, vector3 iv)
{
}

State::~State(void)
{
}

// Recalculates secondary values based on primary values
void State::Recalculate()
{
	velocity = momentum * invMass;
	angularVelocity = angularMomentum * invInertia;
	orientation = orientation.normalized();
	spin = quaternion(0, angularVelocity.x, angularVelocity.y, angularVelocity.z) * orientation * 0.5;
}
